#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
#include <vector>
using namespace std;

class Solution {
public:
    int findnumber(string& s, int& i) {
        int ret = 0;
        while (i < s.size() && s[i] == ' ')
            i++;
        while (s[i] >= '0' && s[i] <= '9')
            ret = ret * 10 + (s[i++] - '0');
        return ret;
    }
    int calculate(string s) {
        string map;
        vector<int> vi;
        int i = 0;
        vi.push_back(findnumber(s, i));
        while (i < s.size()) {
            while (i < s.size() && s[i] == ' ')
                i++;
            if (i < s.size()) {
                if (s[i] == '+')
                    vi.push_back(findnumber(s, ++i));
                else if (s[i] == '-')
                    vi.push_back(-findnumber(s, ++i));
                else {
                    char c = s[i++];
                    int t = findnumber(s, i);
                    if (t == 0)
                        vi[vi.size() - 1] = 0;
                    else if (c == '*')
                        vi[vi.size() - 1] *= t;
                    else
                        vi[vi.size() - 1] /= t;
                }
            }
        }
        int ret = 0;
        for (auto num : vi) ret += num;
        return ret;
    }
};
int main()
{
    Solution s;
    s.calculate("3/2");
}